/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ca.ubc.icapture.genapha.actions;

/**
 *
 * @author btripp
 */
import ca.ubc.icapture.genapha.beans.Login;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * @version 	1.0
 * @author
 */
public class CheckLoginAction extends Action
{

    @Override
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
    {
        ActionForward forward = new ActionForward();
        
        if (Login.getLoggedIn(request.getSession()))
        {
            forward = mapping.findForward("success");

        }
        else
        {
            forward = mapping.findForward("login");
        }

        return (forward);
    }
}
